package org.jeecg.modules.payment.enums;

/**
 * 支付方式枚举
 * 'alipay', 'wechat', 'credit_card', 'bank_transfer'
 * alipay 支付宝   wxpay 微信支付  qqpay QQ钱包
 */
public enum CuPaymentMethodEnum {
    ALIPAY("alipay", "支付宝"),
    WECHAT("wxpay", "微信"),
    CREDIT_CARD("qqpay", "QQ钱包");

    private String code;
    private String name;

    CuPaymentMethodEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    // 根据code获取枚举实例的方法
    public static CuPaymentMethodEnum fromCode(String code) {
        for (CuPaymentMethodEnum method : CuPaymentMethodEnum.values()) {
            if (method.getCode().equals(code)) {
                return method;
            }
        }
        throw null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
